Arrays Methods
#
Setup- Navigate to the
student_examples
folder for today. - Create a file called
array_methods.js
to use for practice code. - Open it in your text editor. Add a
console log
and run your code to confirm that you can see the output in your terminal.
#
Lesson Objectives- Use array methods and research more methods on their own
#
ARRAY METHODS: Adding and Removing Elements#
ActivityIn this lesson we're going to learn how manipulate our arrays. We'll learn how to add items, remove items, do a simple sort and more!
- Let's make an array together called
favMovies
and put everyone's favorite movie in there - We'll share the array in slack and break off into small groups for about
10
minutes and each group will research and give us an explanation and a code example of the following methods
#
Methods - each group gets one- indexOf
- push
- pop
- reverse
- unshift
- shift
- slice
- splice
- sort